<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
	<head>
		<th:block th:replace="tpl :: common_head()"></th:block>
		<title>评论管理</title>
	</head>
	<body th:with="entrance='/system/comment/index'">
		<th:block th:replace="tpl :: common_body(~{::.main-right})">
		<div class="main-right">
			<h1 class="main-right-h1">评论管理</h1>
			<ul class="main-right-tab">
				<li class="selected">评论管理</li>
			</ul>
			<form method="GET" th:object="${query}">
				<div class="main-right-search-group">
					<div class="main-right-search">
						<label>服务名称</label> 
						<input type="text" th:field="*{serviceName}" />
					</div>
					<div class="main-right-search">
						<label>审核状态</label> 
						<select th:field="*{examState}">
							<option value="">未选择</option>
							<option th:each="obj : ${@dictService.getByType('terminateApplyState')}" th:value="${obj.value}" th:text="${obj.label}"></option>
						</select> 
					</div>
					<button type="submit" class="main-right-search-submit">搜&emsp;索</button>
				</div>
				<div class="panel">
					<table class="table">
					    <thead>
					      <tr>
					        <th>操作</th>
					        <th>审核状态</th>
					        <th>驳回理由</th>
					        <th>服务名称</th>
					        <th>评价内容</th>
					        <th>服务</th>
					        <th>速度</th>
					        <th>态度</th>
					        <th>平均分</th>
					        
					      </tr> 
					    </thead>
					    <tbody>
							<tr th:each="obj : ${page.content}" th:object="${obj}">
								<td><a th:href="'javascript:result('+*{id}+');'">通过</a>&nbsp; <a th:href="'javascript:reject('+*{id}+');'">驳回</a></td>
								<td th:text="*{@dictService.getByTypeAndValue('simpleExamState',examState)}"></td>
								<td th:text="*{rejectReason}"></td>
								<td th:text="*{serviceName}"></td>
								<td th:text="*{comment}"></td>
								<td th:text="*{#numbers.formatDecimal(score1/10.0,1,1)}"></td>
								<td th:text="*{#numbers.formatDecimal(score2/10.0,1,1)}"></td>
								<td th:text="*{#numbers.formatDecimal(score3/10.0,1,1)}"></td>
								<td th:text="*{#numbers.formatDecimal(avgScore/10.0,1,1)}"></td>
							</tr>
						</tbody>
					</table>
				</div>
				<div th:replace="tpl :: pagination(${page})"></div>
			</form>
		</div>
		</th:block>
		<script type="text/javascript">
		
			function ok(id) {
				layer.confirm('确定通过吗？', {
					title : '提示'
				}, function(index) {
					window.location.href = "exam?id="+id+"&exam=1";
					layer.close(index);
				});
			}
			
			function reject(id) {
				layer.prompt({
					title : '驳回理由'
				},function(value, index, elem) {
					window.location.href = "exam?id="+id+"&exam=2&rejectReason="+value;
					layer.close(index);
				});
			}
		</script>
	</body>
</html>